﻿using Application.Dto;
using Application.IAppSrevices;
using AutoMapper;
using Domain.Entitys;
using Domain.Repositorys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Application.AppSrevices
{
    public class HFService : IHFService
    {
        private readonly IHFRepository hFRepository;
        private readonly IMapper mapper;

        public HFService(IHFRepository hFRepository,IMapper mapper)
        {
            this.hFRepository = hFRepository;
            this.mapper = mapper;
        }

        /// <summary>
        /// 添加人力资源档案信息
        /// </summary>
        /// <param name="hF"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public Task<int> HFAddAsync(HFAddDto hFAddDto)
        {
            HF hF = mapper.Map<HF>(hFAddDto);
            return hFRepository.HFAddAsync(hF);
        }

        /// <summary>
        /// 根据id查询对应的人力资源信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<HF> HFByIDAsync(int id)
        {
            return await hFRepository.HFByIDAsync(id);
        }

        /// <summary>
        /// 根据人力资源编号查询数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<HF> HFByIDReviewAsync(string id)
        {
            return await hFRepository.HFByIDReviewAsync(id);
        }

        /// <summary>
        /// 根据1，2，3级编号查询对应数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List<HF> HFByKindId(string id)
        {
            return hFRepository.HFByKindId(id);            
        }

        /// <summary>
        /// 人力资源档案变更
        /// </summary>
        /// <param name="hFChangeUpdateDto"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public Task<int> HFChangeUpdateAsync(HFChangeUpdateDto hFChangeUpdateDto)
        {
            HF hF = mapper.Map<HF>(hFChangeUpdateDto);
            return hFRepository.HFChangeUpdateAsync(hF);
        }

        /// <summary>
        /// 查询人力资源总数
        /// </summary>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public Task<int> HFCountAsync()
        {
            return hFRepository.HFCountAsync();
        }

        /// <summary>
        /// 永久删除人力资源档案信息
        /// </summary>
        /// <param name="hFDelete1"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public Task<int> HFDelete(HFDelete1 hFDelete1)
        {
            HF hF = mapper.Map<HF>(hFDelete1);
            return hFRepository.HFDelete(hF);
        }

        /// <summary>
        /// 人力资源档案删除
        /// </summary>
        /// <param name="hFDeleteDto"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public Task<int> HFDeleteAsync(HFDeleteDto hFDeleteDto)
        {
            HF hF = mapper.Map<HF>(hFDeleteDto);
            return hFRepository.HFDeleteAsync(hF);
        }

        /// <summary>
        /// 查询人力资源档案已删除数据
        /// </summary>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<List<HF>> HFDeleteInfoAsync()
        {
            return await hFRepository.HFDeleteInfoAsync();
        }

        /// <summary>
        /// 查询人力资源档案已删除数量
        /// </summary>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public Task<int> HFDeleteInfoCount()
        {
            return hFRepository.HFDeleteInfoCount();
        }

        /// <summary>
        /// 分页查询人力资源档案信息
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public Task<List<HF>> HFFenYeAsync(int pageSize, int pageIndex)
        {
            return hFRepository.HFFenYeAsync(pageSize, pageIndex);
        }

        /// <summary>
        /// 人力资源档案恢复
        /// </summary>
        /// <param name="hFRestoreDto"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public Task<int> HFHFRestoreAsync(HFRestoreDto hFRestoreDto)
        {
            HF hF = mapper.Map<HF>(hFRestoreDto);
            return hFRepository.HFHFRestoreAsync(hF);
        }

        /// <summary>
        /// 人力资源档案复核
        /// </summary>
        /// <param name="hFUpdateDto"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public Task<int> HFReviewAsync(HFUpdateDto hFUpdateDto)
        {
            HF hF = mapper.Map<HF>(hFUpdateDto);
            return hFRepository.HFReviewAsync(hF);
        }

        /// <summary>
        /// 修改人力资源档案实发，应发金额
        /// </summary>
        /// <param name="hFUpdateSalarySumDto"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public Task<int> HFUpdateSalarySumAsync(List<HF> hFs)
        {
            //List<HF> hF = mapper.Map<List<HF>>(hFUpdateSalarySumDto);
            return hFRepository.HFUpdateSalarySumAsync(hFs);
        }

        /// <summary>
        /// 多条件查询人力资源档案数据
        /// </summary>
        /// <param name="fenYe"></param>
        /// <param name="fid"></param>
        /// <param name="sid"></param>
        /// <param name="tid"></param>
        /// <param name="mkid"></param>
        /// <param name="mid"></param>
        /// <param name="keywords"></param>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public FenYe<HF> HFWhereList(FenYe<HF> fenYe, string fid, string sid, string tid, string mkid, string mid, string keywords, string startDate, string endDate)
        {
            return hFRepository.HFWhereList(fenYe,fid,sid,tid,mkid,mid,keywords,startDate,endDate);
        }

        /// <summary>
        /// 多条件查询人力资源等待复核数据
        /// </summary>
        /// <param name="fenYe"></param>
        /// <param name="fid"></param>
        /// <param name="sid"></param>
        /// <param name="tid"></param>
        /// <param name="mkid"></param>
        /// <param name="mid"></param>
        /// <param name="keywords"></param>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public FenYe<HF> HFWhereList2(FenYe<HF> fenYe, string fid, string sid, string tid, string mkid, string mid, string keywords, string startDate, string endDate)
        {
            return hFRepository.HFWhereList2(fenYe, fid, sid, tid, mkid, mid, keywords, startDate, endDate);
        }

                /// <summary>
        /// 多条件查询人力资源档案已复核，和正常状态数据
        /// </summary>
        /// <param name="fenYe"></param>
        /// <param name="fid"></param>
        /// <param name="sid"></param>
        /// <param name="tid"></param>
        /// <param name="mkid"></param>
        /// <param name="mid"></param>
        /// <param name="keywords"></param>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        public FenYe<HF> HFWhereList3(FenYe<HF> fenYe, string fid, string sid, string tid, string mkid, string mid, string keywords, string startDate, string endDate)
        {
            return hFRepository.HFWhereList3(fenYe, fid, sid, tid, mkid, mid, keywords, startDate, endDate);
        }

        /// <summary>
        /// 多条件查询人力资源档案已删除数据
        /// </summary>
        /// <param name="fenYe"></param>
        /// <param name="fid"></param>
        /// <param name="sid"></param>
        /// <param name="tid"></param>
        /// <param name="mkid"></param>
        /// <param name="mid"></param>
        /// <param name="keywords"></param>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public FenYe<HF> HFWhereList4(FenYe<HF> fenYe, string fid, string sid, string tid, string mkid, string mid, string keywords, string startDate, string endDate)
        {
            return hFRepository.HFWhereList4(fenYe, fid, sid, tid, mkid, mid, keywords, startDate, endDate);
        }
    }
}
